package com.wuyb.pojo.entity;

import com.wuyb.enums.ErrorCode;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: wyb
 * @Date: 2023/12/31/14:58
 * @Description:
 */
@Data
public class BaseResponse<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 5066554382739252413L;
    private int code;

    private T data;

    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(int code, T data) {
        this.code = code;
        this.data = data;
    }


    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }

}
